﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Content;
using System.Data.Linq.Mapping;
using System.Reflection;
using MethodWorx.CMS.Plugins;
using MethodWorx.Core.DomainModel;

namespace MethodWorx.CMS.Linq
{
    [Table(Name="dbo.PageTemplateProperty")]
    public class LinqPageTemplateProperty : Property, IPersistable
    {
        [Column(IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public new Guid Id { get { return base.Id; } set { base.Id = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new string Name { get { return base.Name; } set { base.Name = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new string Type { get { return base.Type; } set { base.Type = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new int Index { get { return base.Index; } set { base.Index = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new bool Mandatory { get { return base.Mandatory; } set { base.Mandatory = value; } }
        [Column(UpdateCheck = UpdateCheck.Never, Name = "Custom")]
        public string CustomStorage
        {
            get
            {
                return this.Custom.Base64SerializeUsingXml();
            }
            set
            {
                this.Custom = (ICustomPropertyDetails)value.Base64DeserializeUsingXml();
            }
        }

        [Column(UpdateCheck = UpdateCheck.Never)]
        public new Guid PageTemplateId { get; set; }
        #region Proxy Property For Group
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new string Group { get { return base.Group; } set { base.Group = value; } }
        #endregion
    }
}
